﻿using mak_bll;
using Mak_model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace markets
{
    public partial class huizong : Form
    {
        public huizong()
        {
            InitializeComponent();
        }
         luoji lj = new luoji();
        private void button1_Click(object sender, EventArgs e)
        {
            DateTime star = dateTimePicker1.Value;
            DateTime end = dateTimePicker2.Value;
            if (star > end)
            {
                MessageBox.Show("开始时间不能大于结束时间");
                return;
            }
            List<orderGoods> list = lj.gettop10(star, end);
            dataGridView1.DataSource = new BindingList<orderGoods>(list);

        }

        private void huizong_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;
            dataGridView2.AutoGenerateColumns = false;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DateTime star = dateTimePicker1.Value;
            DateTime end = dateTimePicker2.Value;
            DataGridViewRow dr = dataGridView1.SelectedRows[0];
            string goodscode = dr.Cells["Column1"].Value.ToString();
            List<orderGoods> list = lj.gettop10data(goodscode, star, end);
            dataGridView2.DataSource = new BindingList<orderGoods>(list);

           
        }
    }
}
